/*
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cn.matezk.dms.things.model.req;

import cn.matezk.dms.things.model.entity.SceneActionDO;
import cn.matezk.dms.things.model.entity.SceneConditionDO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import top.continew.starter.extension.crud.model.req.BaseReq;

import java.io.Serial;
import java.util.List;

/**
 * 创建或修改自动场景
 *
 * @author 程道林
 * @since 2025/08/28 10:59
 */
@Data
@Schema(description = "常见或修改自动场景")
public class AutoSceneReq extends BaseReq {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Schema(description = "场景ID")
    private Long id;

    /**
     * 场景名称
     */
    @Schema(description = "场景名称")
    @NotBlank(message = "场景名称不能为空")
    @Length(max = 30, message = "场景名称不能超过 {max} 个字符")
    private String sceneName;

    /**
     * 匹配类型 all/any
     */
    @Schema(description = "匹配类型")
    @NotBlank(message = "匹配类型不能为空")
    private String matchType;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间")
    @NotBlank(message = "开始时间不能为空")
    @Length(max = 5, message = "开始时间不能超过 {max} 个字符")
    private String beginTime;

    /**
     * 截至时间
     */
    @Schema(description = "截至时间")
    @NotBlank(message = "截至时间不能为空")
    @Length(max = 5, message = "截至时间不能超过 {max} 个字符")
    private String endTime;

    /**
     * 指定日期
     */
    @Schema(description = "指定日期")
    @NotBlank(message = "指定日期不能为空")
    @Length(max = 7, message = "指定日期不能超过 {max} 个字符")
    private String days;

    /**
     * 是否使能
     */
    @Schema(description = "是否生效")
    @NotBlank(message = "是否生效不能为空")
    private Boolean enable;

    /**
     * 场景条件
     */
    @Schema(description = "场景条件")
    @NotBlank(message = "场景条件不能为空")
    private List<SceneConditionDO> conditions;

    /**
     * 场景动作
     */
    @Schema(description = "场景动作")
    @NotBlank(message = "场景动作不能为空")
    private List<SceneActionDO> actions;
}